Skip to content

Expose SubscriptionState on License via JWT#3

Open
lucasfischer wants to merge 1 commit into
mainfrom
feat/license-subscription-state
Open

Expose SubscriptionState on License via JWT#3
lucasfischer wants to merge 1 commit into
mainfrom
feat/license-subscription-state

Conversation

@lucasfischer
Copy link
Copy Markdown
Contributor

Adds a subscriptionState: SubscriptionState? field to License, populated from the signed JWT payload. nil means a perpetual / one-time-purchase license; otherwise it reflects the Stripe subscription lifecycle.

SubscriptionState is an enum with associated dates covering the full lifecycle:

  • .renewing(renewsAt:): happy path
  • .canceling(endsAt:canceledAt:): cancellation scheduled, access until endsAt
  • .trialing(trialEndsAt:canceledAt:): in trial; converts to paid unless canceled
  • .pastDue(gracePeriodEndsAt:): payment failed, Stripe retrying
  • .paused
  • .lapsed — terminal (canceled / unpaid / expired)

@simonlouschueler
Copy link
Copy Markdown

Looks great—thank you for implementing it. Especially .canceling(endsAt:canceledAt:) will be very useful to give the user a good overview of the current state of their subscription. We’re arriving at a state where it’s not only simpler to implement than StoreKit, but provides all the same features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants